package com.lineage.server.serverpackets;

import com.lineage.server.model.Instance.L1FollowerInstance;
import com.lineage.server.model.Instance.L1PcInstance;

public class S_FollowerPack extends ServerBasePacket {
  private static final int STATUS_POISON = 1;
  
  private byte[] _byte;
  
  public S_FollowerPack(L1FollowerInstance follower, L1PcInstance pc) {
    this._byte = null;
    writeC(87);
    writeH(follower.getX());
    writeH(follower.getY());
    writeD(follower.getId());
    writeH(follower.getGfxId());
    writeC(follower.getStatus());
    writeC(follower.getHeading());
    writeC(follower.getChaLightSize());
    writeC(follower.getMoveSpeed());
    writeD(0);
    writeH(0);
    writeS(follower.getNameId());
    writeS(follower.getTitle());
    int status = 0;
    if (follower.getPoison() != null && follower.getPoison().getEffectId() == 1)
      status |= 0x1; 
    writeC(status);
    writeD(0);
    writeS(null);
    writeS(null);
    writeC(0);
    writeC(255);
    writeC(0);
    writeC(0);
    writeC(0);
    writeC(255);
    writeC(255);
  }
  
  public byte[] getContent() {
    if (this._byte == null)
      this._byte = getBytes(); 
    return this._byte;
  }
  
  public String getType() {
    return getClass().getSimpleName();
  }
}
